<?php
declare (strict_types=1);

namespace app\exam\event\listeners;

use app\exam\model\admin\PaperTopicLink;
use app\exam\model\admin\QuestionTopic;

/**
 *
 * 试卷关联试题,更新试题引用次数
 *
 * @package app\exam\event\listeners
 */
class PaperTopicLinkCreated
{
    public static function handle(PaperTopicLink $link)
    {
        QuestionTopic::where('id', $link->getAttr('topic_id'))->inc('num')->update();
    }
}